#pragma once
#include <SFML/Graphics/ConvexShape.hpp>
#include <nice2d/widgets/basicbutton.h>

class DirectionButtonStyle : public BasicButtonStyle
{
    DECLARE_OBJECT(DirectionButtonStyle)
public:
    DirectionButtonStyle();

    PTree serialize()override;
    void deserialize(const PTree &node)override;
    void sync()override;

    sf::Color normalButtonColor;
    sf::Color hoverButtonColor;
    sf::Color pressedButtonColor;
};

enum Direction
{
    Direction_Up = 0,
    Direction_Down,
    Direction_Left,
    Direction_Right
};

class DirectionButton : public BasicButton
{
    DECLARE_OBJECT(DirectionButton)
public:
    DirectionButton() = delete;
    DirectionButton(Direction direction = Direction_Up);
    ~DirectionButton();
public:
    Direction getDirection() const;
    sf::Vector2i getHintSize()const;
protected:
    void onDraw(sf::RenderTarget& target,sf::RenderStates states) const override;

    void onPositionChanged() override;
    void onSizeChanged() override;

    void onStyleChanged()override;
private:
    std::unique_ptr<class DirectionButtonData> data;
};
